<html>
<head><meta charset="utf-8"><title>valgrind massif problem · t-compiler/wg-self-profile · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/187831-t-compiler/wg-self-profile/index.html">t-compiler/wg-self-profile</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/187831-t-compiler/wg-self-profile/topic/valgrind.20massif.20problem.html">valgrind massif problem</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="190595304"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187831-t-compiler/wg-self-profile/topic/valgrind%20massif%20problem/near/190595304" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/187831-t-compiler/wg-self-profile/topic/valgrind.20massif.20problem.html#190595304">(Mar 14 2020 at 12:20)</a>:</h4>
<p>I am trying to use valgrind massif on cg_clif compiling issue_20936_deep_vector, however no output file is produced. When I try massif on the resulting executable, it does produce an output file. Is this because rustc is using jemalloc? If so, it would be nice if some message was produced about this.</p>



<a name="190620627"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187831-t-compiler/wg-self-profile/topic/valgrind%20massif%20problem/near/190620627" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/187831-t-compiler/wg-self-profile/topic/valgrind.20massif.20problem.html#190620627">(Mar 14 2020 at 23:46)</a>:</h4>
<p><span class="user-mention" data-user-id="133247">@bjorn3</span> Yes, I believe rustc is still using jemalloc. There might be an exception for certain platforms (Windows, I think, uses the system allocator).</p>



<a name="190620923"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187831-t-compiler/wg-self-profile/topic/valgrind%20massif%20problem/near/190620923" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/187831-t-compiler/wg-self-profile/topic/valgrind.20massif.20problem.html#190620923">(Mar 14 2020 at 23:56)</a>:</h4>
<p>Why does massif completely skip the generation of the result file without warning when jemalloc is used?</p>



<a name="190621236"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187831-t-compiler/wg-self-profile/topic/valgrind%20massif%20problem/near/190621236" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/187831-t-compiler/wg-self-profile/topic/valgrind.20massif.20problem.html#190621236">(Mar 15 2020 at 00:06)</a>:</h4>
<p>I don't have any experience using massif so I couldn't say. <span class="user-mention" data-user-id="120989">@Nicholas Nethercote</span> probably knows the answer though...</p>



<a name="190675379"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187831-t-compiler/wg-self-profile/topic/valgrind%20massif%20problem/near/190675379" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> njn <a href="https://rust-lang.github.io/zulip_archive/stream/187831-t-compiler/wg-self-profile/topic/valgrind.20massif.20problem.html#190675379">(Mar 16 2020 at 00:42)</a>:</h4>
<p>@bjorn3: Does clif spawn any child processes? Valgrind's <code>--trace-children=yes</code> option <em>might</em> help here...</p>



<a name="190691051"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187831-t-compiler/wg-self-profile/topic/valgrind%20massif%20problem/near/190691051" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/187831-t-compiler/wg-self-profile/topic/valgrind.20massif.20problem.html#190691051">(Mar 16 2020 at 07:54)</a>:</h4>
<p>Yes, but only processes that I don't need to be profiled. (ranlib, linker) cg_clif itself is a dylib for rustc.</p>



<a name="190694935"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187831-t-compiler/wg-self-profile/topic/valgrind%20massif%20problem/near/190694935" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> njn <a href="https://rust-lang.github.io/zulip_archive/stream/187831-t-compiler/wg-self-profile/topic/valgrind.20massif.20problem.html#190694935">(Mar 16 2020 at 08:50)</a>:</h4>
<p>does cg_clif call <code>exec()</code> and become another process? That's the only case I can think of off the top of my head for why Massif wouldn't produce it's output</p>



<a name="190703561"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187831-t-compiler/wg-self-profile/topic/valgrind%20massif%20problem/near/190703561" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/187831-t-compiler/wg-self-profile/topic/valgrind.20massif.20problem.html#190703561">(Mar 16 2020 at 10:28)</a>:</h4>
<p>No, cg_clif just keeps running in the context of its parent rustc process. After cg_clif finishes codegen, it returns back to rustc_interface.</p>



<a name="190705745"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187831-t-compiler/wg-self-profile/topic/valgrind%20massif%20problem/near/190705745" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/187831-t-compiler/wg-self-profile/topic/valgrind.20massif.20problem.html#190705745">(Mar 16 2020 at 10:50)</a>:</h4>
<p>It works with <code>--trace-children=yes</code>. Is it possible that threads are not distinguished from processes?</p>



<a name="190706683"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187831-t-compiler/wg-self-profile/topic/valgrind%20massif%20problem/near/190706683" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/187831-t-compiler/wg-self-profile/topic/valgrind.20massif.20problem.html#190706683">(Mar 16 2020 at 11:00)</a>:</h4>
<p>I managed to crash valgrind: <a href="https://gist.github.com/bjorn3/be5eea7120740f5351d8278df14a573c" target="_blank" title="https://gist.github.com/bjorn3/be5eea7120740f5351d8278df14a573c">https://gist.github.com/bjorn3/be5eea7120740f5351d8278df14a573c</a></p>



<a name="190733337"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187831-t-compiler/wg-self-profile/topic/valgrind%20massif%20problem/near/190733337" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/187831-t-compiler/wg-self-profile/topic/valgrind.20massif.20problem.html#190733337">(Mar 16 2020 at 14:56)</a>:</h4>
<p>Why is llvm still running?</p>
<blockquote>
<p>Thread 2: status = VgTs_Runnable (lwpid 21490)<br>
==21488==    at 0x4833DCF: operator new(unsigned long) (vg_replace_malloc.c:334)<br>
==21488==    by 0xA21407E: LLVMBuildMul (in /home/bjorn/.rustup/toolchains/nightly-2020-03-12-x86_64-unknown-linux-gnu/lib/libLLVM-9-rust-1.43.0-nightly.so)<br>
==21488==    by 0x4EF8EF0: rustc_codegen_ssa::glue::size_and_align_of_dst (in /home/bjorn/.rustup/toolchains/nightly-2020-03-12-x86_64-unknown-linux-gnu/lib/librustc_driver-5bafe156ff266a09.so)</p>
</blockquote>



<a name="190738271"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187831-t-compiler/wg-self-profile/topic/valgrind%20massif%20problem/near/190738271" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/187831-t-compiler/wg-self-profile/topic/valgrind.20massif.20problem.html#190738271">(Mar 16 2020 at 15:30)</a>:</h4>
<p>That run was with cg_llvm to compare against cg_clif.</p>



<a name="190785904"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187831-t-compiler/wg-self-profile/topic/valgrind%20massif%20problem/near/190785904" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> njn <a href="https://rust-lang.github.io/zulip_archive/stream/187831-t-compiler/wg-self-profile/topic/valgrind.20massif.20problem.html#190785904">(Mar 16 2020 at 22:05)</a>:</h4>
<p>Threads are definitely distinguished from processes.</p>



<a name="190785944"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187831-t-compiler/wg-self-profile/topic/valgrind%20massif%20problem/near/190785944" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> njn <a href="https://rust-lang.github.io/zulip_archive/stream/187831-t-compiler/wg-self-profile/topic/valgrind.20massif.20problem.html#190785944">(Mar 16 2020 at 22:05)</a>:</h4>
<p>This line appears twice: <code>==21488== Massif, a heap profiler</code></p>



<a name="190786004"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187831-t-compiler/wg-self-profile/topic/valgrind%20massif%20problem/near/190786004" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> njn <a href="https://rust-lang.github.io/zulip_archive/stream/187831-t-compiler/wg-self-profile/topic/valgrind.20massif.20problem.html#190786004">(Mar 16 2020 at 22:06)</a>:</h4>
<p>Which is strange. If the process forked, I would expect the new process to have a different PID</p>



<a name="190786256"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187831-t-compiler/wg-self-profile/topic/valgrind%20massif%20problem/near/190786256" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> njn <a href="https://rust-lang.github.io/zulip_archive/stream/187831-t-compiler/wg-self-profile/topic/valgrind.20massif.20problem.html#190786256">(Mar 16 2020 at 22:09)</a>:</h4>
<p>Or is that output from two separate runs?</p>



<a name="190787676"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187831-t-compiler/wg-self-profile/topic/valgrind%20massif%20problem/near/190787676" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/187831-t-compiler/wg-self-profile/topic/valgrind.20massif.20problem.html#190787676">(Mar 16 2020 at 22:25)</a>:</h4>
<p>That was one single run.</p>



<a name="190787725"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187831-t-compiler/wg-self-profile/topic/valgrind%20massif%20problem/near/190787725" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/187831-t-compiler/wg-self-profile/topic/valgrind.20massif.20problem.html#190787725">(Mar 16 2020 at 22:25)</a>:</h4>
<p>By the way my version of valgrind came with debian, so it may be relatively old.</p>



<a name="190810366"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187831-t-compiler/wg-self-profile/topic/valgrind%20massif%20problem/near/190810366" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> njn <a href="https://rust-lang.github.io/zulip_archive/stream/187831-t-compiler/wg-self-profile/topic/valgrind.20massif.20problem.html#190810366">(Mar 17 2020 at 05:49)</a>:</h4>
<p>You have 3.14, 3.15 is the current release, but it shouldn't matter</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>